package com.example.visiter.service.impl;

import com.example.visiter.service.Visitor;
import com.example.visiter.vo.Board;
import com.example.visiter.vo.CPU;
import com.example.visiter.vo.Memory;

public class PersonVisitor implements Visitor {
    private double totalPrice=0.0;

    @Override
    public void visitCpu(CPU cpu) {
        this.totalPrice+=cpu.getPrice()*0.5;
    }

    @Override
    public void visitMemory(Memory memory) {
        this.totalPrice+= memory.getPrice()*0.7;
    }

    @Override
    public void visitBoard(Board board) {
        this.totalPrice+= board.getPrice()*0.8;
    }

    public double getTotalPrice() {
        return this.totalPrice;
    }
}
